<template>
  <div class="tablewrap">
    <div>当前已参加的活动</div>
    <FilterTable :columns="columns" :isColumnFilter="false" :dataSource="dataSource" :height="200" :onColumnsChange="columns => (this.columns = columns)" :isSelectColumn="false"></FilterTable>
  </div>
</template>

<script>
import moment from 'moment';
import { queryActivityResult } from '@/api/repair/repairReception/customer/monitoring.js';
export default {
  name: 'HuoDong1',
  props: {
    queryParams: Object
  },
  data() {
    return {
      // 活动 已选的
      dataSource: [],
      columns: this.createColumnsActivitiesAlready()
    };
  },
  mounted() {
    this.queryActivityResult();
  },
  methods: {
    // 查询 已选活动
    async queryActivityResult() {
      const params = {
        sort: 'ACTIVITY_CODE',
        order: 'asc',
        limit: 10,
        offset: 0,
        ...this.queryParams
        // LICENSE: '陕A2FU00',
        // vin: '09876543219876543',
        // ownerNo: 'OW1907110001',
        // BRAND: 'LINCOLN',
        // MILEAGE: 999999,
        // isRepairOrder: 'REPAIR_ORDER_TAG',
        // dmsFuncId: 35100010,
        // createDate: moment().format('YYYY-MM-DD HH-mm'),
        // _: new Date().getTime()
      };
      const res = await queryActivityResult(params);
      console.log('查询已选活动', params, res);
      this.dataSource = res.data.rows;
    },
    createColumnsActivitiesAlready() {
      return [
        {
          title: '序号',
          width: 50,
          render: props => {
            return <span>{props.$index + 1}</span>;
          }
        },
        {
          title: '活动编号',
          dataIndex: 'ACTIVITY_CODE'
        },
        {
          title: '活动名称',
          dataIndex: 'ACTIVITY_NAME'
        },
        {
          title: 'VIN',
          dataIndex: 'VIN'
        },
        {
          title: '经销商名称',
          dataIndex: 'DEALER_NAME'
        },
        {
          title: '参加活动时间',
          dataIndex: 'CAMPAIGN_DATE'
        }
      ];
    }
  }
};
</script>

<style scoped></style>
